package com.itheima.tcpcn;

import java.io.*;
import java.net.Socket;

public class CilentDemo {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1",10060);
        OutputStream outputStream = socket.getOutputStream();
        outputStream.write("hello".getBytes());
        socket.shutdownOutput();
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        String b ;
        while((b=bufferedReader.readLine())!=null){
            System.out.println(b);
        }
        /*InputStream inputStream = socket.getInputStream();
        int b;
        while ((b=inputStream.read())!=-1){
            System.out.println((char)b);
        }*/
        bufferedReader.close();
        outputStream.close();
        socket.close();
    }

}
